// import request from '@/utils/request'
import request_video from '@/utils/request_copy'//视频接口成功code:'0'
// import request_ssa from '@/utils/request_zjg_ssa'//ssa单独的request
const CryptoJS = require("crypto-js");
// let ZJG_BASE = '/ssa-video-zjg-api'//本地
let ZJG_BASE = 'http://qcx.etmobile.net:50000'//打包，视频用etmobile
// let SSA_BASE = '/ssa-pc-api-spaq'//本地
let SSA_BASE = 'https://spaq.suzhou.gov.cn'//打包，企业图用spaq.suzhou


import axios from "axios";

//获取区域树//新
export function getTreeList(data) {
  return request_video({
    url: "http://qcx.etmobile.net:50000/ssa-pc-api/video/map/findList",
    method: "post",
    data
  });
}

//获取监控点状态
export function getCameraStatus(data) {
    return request_video({
      url: ZJG_BASE + "/ssa-pc-api/camera/indexCode",
      method: "post",
      data,
    });
  }
  


//获取监控点回放取流URL
export function playbackURLs(data) {
  return request_video({
    url: ZJG_BASE + "/ssa-pc-api/camera/playbackURLs",
    method: "post",
    data,
  });
}

//获取监控点预览取流URL//新
export function previewURLs(data) {
  return request_video({
    url: ZJG_BASE + "/ssa-pc-api/artemis/getPreviewParam",
    method: "post",
    data,
  });
}
























function ssaaesEncrypt(data, key) {
    //console.log("data:"+data);
    key = CryptoJS.enc.Utf8.parse(key);
    var srcs = CryptoJS.enc.Utf8.parse(data);
    var encrypted = CryptoJS.AES.encrypt(srcs, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
    //console.log("data后:"+encrypted.toString());
    var a =encrypted.toString();
    return a;
  }
  





export function GetToken_video(userid) {
    return axios
      .post("http://qcx.etmobile.net:50000/ssa-pc-api/code/saveCode", {
        id: userid
      }, {
        headers: { timestamp: ssaaesEncrypt(Date.parse(new Date()), '53af4e0914f92ac0') },
      })
  }






